package com.qf.action;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.google.gson.Gson;
import com.qf.base.BaseServlet;
import com.qf.model.Category;
import com.qf.service.impl.CategoryServiceImpl;

/**
 * Servlet implementation class CategoryServlet
 */
public class CategoryServlet extends BaseServlet {
	private static final long serialVersionUID = 1L;
       
	protected void category(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		response.setContentType("text/html;charset=utf-8");
		List<Category> list=categoryServiceImpl.findall();
//		System.out.println(list);
		Gson gson = new Gson();
		String json = gson.toJson(list);
		response.getWriter().write(json);
		
	}



}
